package kr.salebeans.cm.domain.customer;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

import kr.salebeans.cm.domain.common.DataHandling;
import kr.salebeans.cm.util.DateUtils;

@Entity
@Table(name = "CU_CUSTOMER")
public class Customer implements Serializable {

    /**
     * 
     */
    private static final long serialVersionUID = -3162763390282498990L;

    @Id
    @GeneratedValue(generator = "SQ_CU_CUSTOMER")
    @SequenceGenerator(name = "SQ_CU_CUSTOMER", initialValue = 1, allocationSize = 1, sequenceName = "SQ_CU_CUSTOMER")
    @Column(name = "ID")
    private long id;

    @Column(name = "CUSTOMER_NM", length = 100, nullable = false)
    private String customerName;

    @Column(name = "GENDER", length = 1, nullable = false)
    private String gender;

    @Column(name = "REMARK", length = 500, nullable = true)
    private String remark;

    @Column(name = "SHOP_ID", length = 6, nullable = false)
    private String shopId;

    @Embedded
    private ContactPoint contactPoint;

    @Embedded
    private DataHandling handling;

    public Customer() {
    }

    public void createNewHandling() {
        DataHandling newHandling = new DataHandling();
        newHandling.setRegisterDateTime(DateUtils.getCurrentBaseDateString());
        newHandling.setUpdateDateTime(DateUtils.getCurrentBaseDateString());
        newHandling.setUseYn(true);
        this.setHandling(newHandling);
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getCustomerName() {
        return customerName;
    }

    public void setCustomerName(String customerName) {
        this.customerName = customerName;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public String getShopId() {
        return shopId;
    }

    public void setShopId(String shopId) {
        this.shopId = shopId;
    }

    public ContactPoint getContactPoint() {
        return contactPoint;
    }

    public void setContactPoint(ContactPoint contactPoint) {
        this.contactPoint = contactPoint;
    }

    public DataHandling getHandling() {
        return handling;
    }

    public void setHandling(DataHandling handling) {
        this.handling = handling;
    }

}
